﻿
function RemoveLecturerClick(num, text) {
    var x = window.confirm("Do you want to Remove lecturer: " + text + "?");
    if (x) {
        var url = document.location.href;
        document.forms["submitForm"].elements["hiddenID"].value = num;
        document.forms["submitForm"].elements["action"].value = "remove";
        document.forms["submitForm"].action = url;
        document.forms["submitForm"].submit();
    };

};
function RemoveStudentClick(num, text) {
    var x = window.confirm("Do you want to Remove student: " + text + "?");
    if (x) {
        var url = document.location.href;
        document.forms["submitForm"].elements["hiddenID"].value = num;
        document.forms["submitForm"].elements["action"].value = "remove";
        document.forms["submitForm"].action = url;
        document.forms["submitForm"].submit();
    };

};
function EditStudentCheck(num) {
    var temp = document.forms["submitForm"].elements["studentList"].value;
    var aStudetnList=new Array();
    if (temp.length > 0) {
        aStudetnList = temp.split(",");
    };
        if (!aStudetnList.contains(num)) {
            aStudetnList.push(num);
        };
        document.forms["submitForm"].elements["studentList"].value = aStudetnList;
    
};

function import() {
    document.forms["submitForm"].elements["action"].value = "import";
    document.forms["submitForm"].submit();
};

function submitSession(text) {
    document.forms["studentsessionForm"].elements["action"].value = text;
    document.forms["studentsessionForm"].submit();
};

Array.prototype.contains = function ( needle ) {
   for (i in this) {
       if (this[i] == needle) return true;
   }
   return false;
}
